<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <title>Document</title>
  <script src="./ezuikit.js"></script>
</head>
<body>
  <div className="demo">
    <h2>视频模式使用示例：</h2>
    <div id="video-container"
      style="width:800px;"
      >
    </div>
    <div>
    <button onClick="play()">play</button>
    <button onClick="stop()">stop</button>
    <button onClick="getOSDTime()">getOSDTime</button>
    <button onClick="getOSDTime2()">getOSDTime2</button>
    <button onClick="capturePicture()">capturePicture</button>
    <button onClick="openSound()">openSound</button>
    <button onClick="closeSound()">closeSound</button>
    <button onClick="startSave()">startSave</button>
    <button onClick="stopSave()">stopSave</button>
    <button onClick="startTalk()">开始对讲</button>
    <button onClick="stopTalk()">结束对讲</button>
    <button onClick="fullScreen()">全屏</button>
    </div>
    <p style="font-style: italic;">播放多个视频，可初始化多个实例，参考：/demos/base-demo/multi-demo</p>
  </div>
  <script>
    var playr = new EZUIKit.EZUIKitPlayer({
      id: 'video-container', // 视频容器ID
      accessToken: 'at.1yjuprkk36992fts8qw4f0ladd9lju2y-1744sk6eh7-00cbr9r-ypsznozt8',
      url: 'ezopen://open.ys7.com/203751922/1.live',
      template: 'simple', // simple - 极简版;standard-标准版;security - 安防版(预览回放);voice-语音版；
      autoplay: true,
      // 视频上方头部控件
      header: ['capturePicture','save','zoom'],            // 如果templete参数不为simple,该字段将被覆盖
      // 视频下方底部控件
       footer: ['talk','broadcast','hd','fullScreen'],      // 如果template参数不为simple,该字段将被覆盖
      // audio: 1, // 是否默认开启声音 0 - 关闭 1 - 开启
      // plugin: ['talk'],                       // 加载插件，talk-对讲
      // controls: true, //['play','voice','hd','fullScreen'], // 视频控制相关控件，如果template参数不为simple,该字段将被覆盖
      openSoundCallBack: (data) => console.log("开启声音回调",data),
      closeSoundCallBack: (data) => console.log("关闭声音回调",data),
      startSaveCallBack: (data) => console.log("开始录像回调",data),
      stopSaveCallBack: (data) => console.log("录像回调",data),
      capturePictureCallBack: (data) => console.log("截图成功回调",data),
      fullScreenCallBack: (data) => console.log("全屏回调",data),
      fullScreenChangeCallBack: (data) => console.log("全屏变化回调",data),
      getOSDTimeCallBack: (data) => console.log("获取OSDTime回调",data),
      handleSuccess: (data) = function(){console.log("播放成功回调",data)},
      handleError: (data) => console.log("播放失败回调1",data),
      handleTalkSuccess: () => console.log("对讲成功回掉"),
      handleTalkError: (data) = function(){console.log("对讲失败",data)},
      decoderVersion: "v3.4",
      width:800,
      height:600,
    });
    function fullScreen(){
      var playPromise = playr.fullScreen();
      playPromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })      
    }
    function play() {
      var playPromise = playr.play();
      playPromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })
    }
    function stop() {
      var stopPromise = playr.stop();
      stopPromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })
    }
    function getOSDTime() {
      var getOSDTimePromise = playr.getOSDTime();
      getOSDTimePromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })
    }
    function getOSDTime2() {
      var getOSDTimePromise = playr2.getOSDTime();
      getOSDTimePromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })
    }
    function capturePicture() {
      var capturePicturePromise = playr.capturePicture();
      capturePicturePromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })
    }
    function openSound() {
      var openSoundPromise = playr.openSound();
      openSoundPromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })
    }
    function closeSound() {
      var closeSoundPromise = playr.closeSound();
      closeSoundPromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })
    }
    function startSave() {
      var startSavePromise = playr.startSave();
      startSavePromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })
    }
    function stopSave() {
      var stopSavePromise = playr.stopSave();
      stopSavePromise.then((data)=>{
        console.log("promise 获取 数据",data)
      })
    }
  </script>
</body>
</html>
